package com.ysl.modulea;

import android.os.Bundle;
import android.util.Log;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.example.base.MProvider;
import com.example.base.MProviderImpl;

@Route(path="/modulea/ArouterActivityA")
public class ArouterActivityA extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_aroutera);

        findViewById(R.id.btna).setOnClickListener(v -> ARouter.getInstance().build("/moduleb/ArouterActivityB").navigation());

        MProvider navigation = ARouter.getInstance().navigation(MProvider.class);
//        MProvider navigation = (MProvider) ARouter.getInstance().build("/base/myp").navigation();
        Log.d("------》", "onCreate: "+navigation);


        // 使用一：by name
        LocationService locationService = (LocationService) ARouter.getInstance().build("/Loc/LocationService").navigation();
        Log.d("------》", "onCreate: "+locationService);
        locationService.startLocate();

        //使用二： by type
        LocationService locationService1 = ARouter.getInstance().navigation(LocationService.class);
        Log.d("------》", "onCreate: "+locationService1);
        locationService1.startLocate();

    }
}
